#include "CustomMenu.h"
#include "CustomMenu.h"
#include "vtkObject.h"
#include "vtkKWMenu.h"
#include "vtkSlicerApplication.h"
#include "vtkMRMLLinearTransformNode.h"
vtkStandardNewMacro(CustomMenu);

CustomMenu::CustomMenu(void)
{
}

CustomMenu::~CustomMenu(void)
{
}

void CustomMenu::BuildGUI(void)
{
	vtkSlicerApplication * app = (vtkSlicerApplication * )GetApplication();
	vtkSlicerWindow * MW = app->GetApplicationGUI()->GetMainSlicerWindow();
	vtkKWMenu * menu = MW->GetMenu();
	vtkKWMenu * EndoscopeMenu = vtkKWMenu::New();
	EndoscopeMenu->SetParent(menu);
	EndoscopeMenu->Create();
	menu->AddCascade("Virtual Scene", EndoscopeMenu);
	EndoscopeMenu->InsertCommand(0, "Command1");
	EndoscopeMenu->InsertCommand(1, "Command2");
	EndoscopeMenu->AddObserver(vtkKWMenu::MenuItemInvokedEvent, this->GUICallbackCommand);
	EndoscopeMenu->Delete();
}


void CustomMenu::ProcessGUIEvents( vtkObject *caller,
								  unsigned long event, void *callData )
{
	int index = *reinterpret_cast<int *> (callData);
	vtkMRMLLinearTransformNode *node;
	switch(index)
	{
	case 0:
		//GetApplication()->Script("tk_messageBox -message %s", GetMRMLScene()->GetNodeByID("vtkMRMLLinearTransformNode4") == NULL ? "NULL" : GetMRMLScene()->GetNodeByID("vtkMRMLLinearTransformNode4")->GetClassName());

		break;
	case 1:
		//GetApplication()->Script("tk_messageBox -message command1");
		break;
	}
	//this->MRMLScene->GetNthNode(0);
}
